// --------------------------------------------------------------------------------------------------------------------
// <copyright file="WebInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Defines the WebInfo type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.Saf.Actions.Wss.Entities
{
    using System;
    using System.Xml.Serialization;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [Serializable]
    [CollaborisClass(Title = "Web Information", ReleaseStatus = ReleaseStatus.Stable,
        Summary = "Defines a set of parameters to create a SharePoint Web (SPWeb).")]
    public class WebInfo : WSSEntityBase
    {
        #region Constants and Fields

        private string description;

        private uint? lcid;

        private bool? overwrite;

        private string template;

        private string title;

        private string url;

        private bool? useUniquePerms;

        private string webName;

        #endregion

        #region Properties

        [CollaborisProperty(Summary = "Specifies the description for the new web.", Title = "Description",
            Example = "New Web created by SAF", Required = false, InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        [CollaborisProperty(Summary = "Specifies the locale ID for the new web.", Title = "Locale Id", Example = "1033",
            Required = false, InputHint = InputHint.NullableNumber)]
        [XmlElement(IsNullable = true)]
        public uint? Lcid
        {
            get
            {
                return this.lcid;
            }
            set
            {
                this.lcid = value;
            }
        }

        [CollaborisProperty(Summary = "Specifies whether to overwrite the web if it already exists.", Title = "Overwrite",
            Example = "true", Required = false, InputHint = InputHint.NullableBoolean)]
        [XmlElement(IsNullable = true)]
        public bool? Overwrite
        {
            get
            {
                return this.overwrite;
            }
            set
            {
                this.overwrite = value;
            }
        }

        [CollaborisProperty(Summary = "Specifies whether to overwrite the web if it already exists.", Title = "Overwrite",
            Example = "STS#0",
            Remarks = @"To find the template ID follow this guide " +
                      @"<a href=""http://www.ehow.com/how_4819338_stsadm-template-codes-script-creation.html"">" +
                      @"'How to use STSADM to Find Site Template Codes and Script Site Creation'.</a>", 
            Required = false, 
            InputHint = InputHint.NullableBoolean)]
        [XmlElement(IsNullable = true)]
        public string Template
        {
            get
            {
                return this.template;
            }
            set
            {
                this.template = value;
            }
        }

        [CollaborisProperty(
            Summary = "Specifies the title for the new web.", 
            Title = "Overwrite",
            Example = "New Web title",
            Required = false,
            InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string Title
        {
            get
            {
                return this.title;
            }
            set
            {
                this.title = value;
            }
        }

        [CollaborisProperty(
                    Summary = "Specifies the relative URL for the new web.",
                    Title = "Url",
                    Example = "NewWeb",
                    Required = false,
                    InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string Url
        {
            get
            {
                return this.url;
            }
            set
            {
                this.url = value;
            }
        }

        [CollaborisProperty(
            Summary = "Specifies whether to use unique permissions for the new web.",
            Title = "Use Unique Perms",
            Example = "false",
            Required = false,
            InputHint = InputHint.NullableBoolean)]
        [XmlElement(IsNullable = true)]
        public bool? UseUniquePerms
        {
            get
            {
                return this.useUniquePerms;
            }
            set
            {
                this.useUniquePerms = value;
            }
        }

        [CollaborisProperty(
            Summary = "Specifies the name for the new web.",
            Title = "Web Name",
            Example = "New Web name",
            Required = false,
            InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string WebName
        {
            get
            {
                return this.webName;
            }
            set
            {
                this.webName = value;
            }
        }

        #endregion

        /// <summary>
        /// Defines some constants relating to the Properties.
        /// </summary>
        public static class Props
        {
            #region Constants and Fields

            public static readonly string DeleteOnUndo = "DeleteOnUndo";

            public static readonly string Description = "WebDescription";

            public static readonly string LCID = "WebLCID";

            public static readonly string Overwrite = "WebOverwrite";

            public static readonly string Template = "WebTemplate";

            public static readonly string Title = "WebTitle";

            public static readonly string Url = "WebUrl";

            public static readonly string UseUniquePerms = "WebUseUniquePerms";

            public static readonly string WebName = "WebName";

            #endregion
        }
    }
}